package com.xgst.readbook.launch

import com.blankj.utilcode.BuildConfig
import com.blankj.utilcode.util.LogUtils
import com.hjq.http.EasyConfig
import com.hjq.http.config.LogStrategy
import com.xgst.readbook.base.BaseActivity
import com.xgst.readbook.databinding.ActivitySplasyLayoutBinding
import com.xgst.smallscreen.http.RequestHandler
import com.xgst.smallscreen.http.RequestServer
import okhttp3.OkHttpClient

class SplashActivity:BaseActivity<ActivitySplasyLayoutBinding>() {

    override fun viewBinding() = ActivitySplasyLayoutBinding.inflate(layoutInflater)

    override fun init() {
        val okHttpClient = OkHttpClient.Builder()
            .build()
        EasyConfig.with(okHttpClient)
            .setServer(RequestServer())
            .setHandler(RequestHandler())
            .setRetryCount(3)
            .into()

        if (!BuildConfig.DEBUG) {
            LogUtils.getConfig().isLogHeadSwitch = false
            EasyConfig.getInstance().logStrategy = LogStrategy()
        }

        startActivity(LoginActivity::class.java)
    }
}